﻿#include <iostream>
#include <vector>

using namespace std;
bool cmp(vector<int>& A, vector<int>& B)
{
	/*
	if (A.size() > B.size()) return true;
	else if (A.size() == B.size())
	{
		for (int i = A.size() - 1; i >= 0; i--)
		{
			if (A[i] > B[i])
				return true;
			else if (A[i] == B[i])
				return true;
			return false;
		}
	}
	return false;*/
	if (A.size() != B.size())
		return A.size() > B.size();
	for (int i = A.size() - 1; i >= 0; i--)
		if (A[i] != B[i])
			return A[i] > B[i];
	return true;
}
vector<int>subtraction(vector<int>& A, vector<int>& B)
{
	vector<int>C;
	int temp = 0;  //临时变量，存放每位的值和进位的值
	for (int i = 0; i < A.size(); i++)
	{
		temp = A[i] - temp;
		if (i < B.size()) temp -= B[i];
		C.push_back((temp + 10) % 10);
		if (temp < 0)temp = 1;
		else temp = 0;
	}
	while (C.size() > 1 && C.back() == 0)
		C.pop_back();

	return C;
}
int main()
{
	string a, b;
	vector<int>A, B;
	cin >> a >> b;
	for (int i = a.size() - 1; i >= 0; i--)
		A.push_back(a[i] - '0');
	for (int i = b.size() - 1; i >= 0; i--)
		B.push_back(b[i] - '0');

	if (cmp(A, B)) //如果A大于等于B
	{
		auto C = subtraction(A, B);
		for (int i = C.size() - 1; i >= 0; i--)
			cout << C[i];
	}
	else//否则
	{
		auto C = subtraction(B, A);
		cout << "-"; //输出一个负号
		for (int i = C.size() - 1; i >= 0; i--)
			cout << C[i];
	}
	system("pause");
	return 0;
};